/*
 * @Author: 贾博林 11457230+jabolin@user.noreply.gitee.com
 * @Date: 2023-03-29 09:58:59
 * @LastEditors: 贾博林 11457230+jabolin@user.noreply.gitee.com
 * @LastEditTime: 2023-03-30 11:05:31
 * @FilePath: \zs-grouting2\naive-ui-admin\src\components\bf-form-parse\src\bf-form.parse.ts
 * @Description: 封装表单
 */
import {
  ColorPickerProps,
  DatePickerProps,
  InputNumberProps,
  RadioProps,
  SelectProps,
  InputProps,
  TimePickerProps,
  TransferProps,
  UploadProps,
  CheckboxProps,
  TreeProps
} from 'naive-ui'

export type BFFormItemType =
  | 'text'
  | 'textarea'
  | 'number'
  | 'select'
  | 'transfer'
  | 'timePicker'
  | 'datePicker'
  | 'colorPicker'
  | 'radio'
  | 'checkbox'
  | 'upload'
  | 'custom'
  | 'tree'

export interface BFFormItem {
  label?: string
  keyPath?: string // 取值路径 以.分割
  type?: BFFormItemType
  labelAlign?: 'left' | 'right'
  labelPlacement?: 'left' | 'top'
  labelWidth?: number | string | 'auto'
  tabKey?: string
  span?: number
  offset?: number
  textProps?: InputProps
  textareaProps?: InputProps
  numberProps?: InputNumberProps
  selectProps?: SelectProps
  transferProps?: TransferProps
  timePickerProps?: TimePickerProps
  datePickerProps?: DatePickerProps
  colorPickerProps?: ColorPickerProps
  treeProps?: TreeProps
  radioProps?: {
    options: { label: string }[] & RadioProps[]
  }
  checkboxProps?: {
    options: { label: string }[] & CheckboxProps[]
  }
  uploadProps?: UploadProps

  pos?: 'modal' | 'filter'
}

export interface BFTabsForm {
  tabTitle?: string
  tabKey?: string
  template?: BFFormItem[]
}

export interface BFFormParseProps {
  value?: Record<string, any>
  template?: Array<BFTabsForm & BFFormItem>
}

export interface BFFormParseExpose {
  getFormData(): any
}
